
package com.hd.appcommon.enums;

/**
 * 门锁秘钥类型
 * @author hzp
 * @Desc 录入密钥类型
 */
public enum KeyType {
	
	PASSWORD("password","密码"),	// 长效密码
	
	CARD("card","卡"),				// IC卡(平台下发)，身份证UUID， IC卡(门锁录入)

	FINGER_PRINT("fingerPrint","指纹"),
	
	SNAP_KEY("snapKey","临时秘钥"), // 临时密码
	
	OFFLINE_PWD("offlinePwd","离线密码"), // 离线密码
	
	ALL("all","所有类型"),
	
	UNKNOWN("unknown","未知");

	private String code;
	
	private String des;
	
	private KeyType(String code, String des) {
		this.code = code;
		this.des = des;
	}
	
	public static KeyType getByCode(String code){
		for(KeyType keyType : KeyType.values()){
			if(keyType.getCode().equals(code)){
				return keyType;
			}
		}
		return null;
	}
	
	public static String getDesByCode(String code){
		for(KeyType keyType : KeyType.values()){
			if(keyType.getCode().equals(code)){
				return keyType.getDes();
			}
		}
		return null;
	}
	
	public String getCode() {
		return code;
	}

	public String getDes() {
		return des;
	}
}
